package cn.amaake.magicplugin.rpc.service;

import cn.amaake.magicplugin.rpc.model.RpcProviderInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.ssssssss.magicapi.core.event.FileEvent;
import org.ssssssss.magicapi.core.event.GroupEvent;
import org.ssssssss.magicapi.core.service.AbstractMagicDynamicRegistry;
import org.ssssssss.magicapi.core.service.MagicResourceStorage;

public class RpcProviderInfoMagicDynamicRegistry extends AbstractMagicDynamicRegistry<RpcProviderInfo> {

    private static final Logger logger = LoggerFactory.getLogger(RpcProviderInfoMagicDynamicRegistry.class);

    public RpcProviderInfoMagicDynamicRegistry(MagicResourceStorage<RpcProviderInfo> magicResourceStorage) {
        super(magicResourceStorage);
    }


    @EventListener(condition = "#event.type == 'rpcprovider'")
    public void onFileEvent(FileEvent event) {
        processEvent(event);
    }

    @EventListener(condition = "#event.type == 'rpcprovider'")
    public void onGroupEvent(GroupEvent event) {
        processEvent(event);
    }


    @Override
    protected boolean register(MappingNode<RpcProviderInfo> mappingNode){
        return super.register(mappingNode);
    }

    @Override
    protected void unregister(MappingNode<RpcProviderInfo> mappingNode){

    }

}
